<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../../d27/js/jquery.js"></script>
    <style>
        #box {
            height: 500px;
            width: 800px;
            border: 2px solid #c0c0c0;

            position: relative;
            margin: 100px auto;
        }

        * {
            margin: 0;
            padding: 0;
        }

        ul {
            list-style: none;
            height: 100%;
            width: 100%;
        }

        ul>li {
            height: 100%;
            width: 100%;
            position: absolute;
            font-size: 30px;
            text-align: center;

            opacity: 0;

        }

        li:nth-child(1) {
            opacity: 1;
        }

        li:nth-child(1) {

            /*background-color: red;*/
        }

        li:nth-child(2) {
            /*background-color: yellow;*/
        }

        li:nth-child(3) {
            /*background-color: green;*/
        }

        li:nth-child(4) {
            /*background-color: #0094ff;*/
        }

        li:nth-child(5) {
            /*background-color: pink;*/
        }

        ol {
            list-style: none;
            width: 100%;
            margin-top: 5px;
        }

        ol>li {
            height: 100px;
            width: 146px;
            margin-left: 8px;
            float: left;
            text-align: center;
            border: 1px solid #999999;
            opacity: .2;
        }

        ol>li img {
            height: 100px;
            width: 146px;
            float: left;
        }
    </style>

</head>

<body>


    <div id="box">
        <ul id="ul">
            <li><a href="javascript:void(0)"><img src="images/slidepic1.jpg" alt="" /></a></li>
            <li><a href="javascript:void(0)"><img src="images/slidepic2.jpg" alt="" /></a></li>
            <li><a href="javascript:void(0)"><img src="images/slidepic3.jpg" alt="" /></a></li>
            <li><a href="javascript:void(0)"><img src="images/slidepic4.jpg" alt="" /></a></li>
            <li><a href="javascript:void(0)"><img src="images/slidepic5.jpg" alt="" /></a></li>
        </ul>

        <ol id="ol">
            <li><a href="javascript:void(0)"><img src="images/slidepic1.jpg" alt="" /></a></li>
            <li><a href="javascript:void(0)"><img src="images/slidepic2.jpg" alt="" /></a></li>
            <li><a href="javascript:void(0)"><img src="images/slidepic3.jpg" alt="" /></a></li>
            <li><a href="javascript:void(0)"><img src="images/slidepic4.jpg" alt="" /></a></li>
            <li><a href="javascript:void(0)"><img src="images/slidepic5.jpg" alt="" /></a></li>
        </ol>
    </div>
</body>

</html>
<script>
  $(function(){
    let $index=0;
        $.fn.extend({
            autoPlay(){
                let self=this;
                if($index>5){
                    $index=0;
                }
                this.find("#ul>li").eq($index).css("opacity",1).siblings().css("opacity",0)
                this.find("#ol>li").eq($index).css("opacity",1).siblings().css("opacity",0.2)
            }
        })

        $.fn.extend({
            mouse(){
                $(this).find("#ol>li").click(function(){
                    $(this).css("opacity",1).siblings().css("opacity",0.2)
                    var $temp=$(this).index()
                    $index=$temp;
                    $(this).parent().siblings().children().eq($temp).css("opacity",1).siblings().css("opacity",0)
                })
                var timer=setInterval(function(){
                    $("#box").autoPlay()
                    $index++;
                },1500)
                $(this).mouseenter(function(){
                    clearInterval(timer)
                })
                $(this).mouseleave(function(){
                    timer=setInterval(function(){
                        $("#box").autoPlay()
                        $index++;
                    },1500)
                })
            }
        })

        $(function(){
            $("#box").mouse()
        })
  })
</script>